import { request, requestSync } from '@/utils/request'

export const getRoleList = () => {
  return requestSync({
    url: '/system/role/listRole',
    method: 'post',
  })
}

export const listByRoleId = roleId => {
  return requestSync({
    url: '/system/roleMenu/listByRoleId',
    method: 'post',
    params:{
      roleId:roleId
    }
  })
}

export const roleMenuUpdate = data => {
  return requestSync({
    url: '/system/roleMenu/update',
    method: 'post',
    data
  })
}

export const getMenuList = () => {
  return requestSync({
    url: '/system/roleMenu/getMenuList',
    method: 'post',
  })
}

export const roleAdd = roleName => {
  return requestSync({
    url: '/system/role/add',
    method: 'post',
    params:{
      roleName
    }
  })
}

export const roleUpdate = data => {
  return requestSync({
    url: '/system/role/update',
    method: 'post',
    data
  })
}

export const roleDel = roleId => {
  return requestSync({
    url: '/system/role/del',
    method: 'post',
    params:{roleId}
  })
}
